package com.szlanyou.thirdsdk.retrofit.loading;

import android.app.Activity;
import android.app.Application;

import com.szlanyou.thirdsdk.retrofit.client.LoadingActionManager;

import java.lang.ref.WeakReference;

/**
 * @author 陈章
 * create at 2020/11/6 16:45
 * desc:用于Retrofit请求的loading显示
 */
public abstract class NetLoadingStateAction implements ILoading {
    public WeakReference<Activity> attachActivity;
    public WeakReference<Application> attachApplication;

    public NetLoadingStateAction(Activity attachActivity) {
        this.attachActivity = new WeakReference<>(attachActivity);
    }

    public NetLoadingStateAction(Application attachApplication) {
        this.attachApplication = new WeakReference<>(attachApplication);
    }


    public NetLoadingStateAction() {
    }

    public Activity getActivity() {
        if (attachActivity == null) {
            return null;
        } else {
            return attachActivity.get();
        }
    }

}
